package com.haoshuang.zhouzhoubang.ui.page.data

import android.content.Context
import android.os.Bundle
import com.haoshuang.zhouzhoubang.databinding.ActivityDataStatisticsBinding
import com.haoshuang.zhouzhoubang.ui.adapter.ViewPagerAdapter
import com.haoshuang.zhouzhoubang.ui.page.data.cate.CategoryStatisticsFragment
import com.haoshuang.zhouzhoubang.ui.page.data.data.DataStatisticsFragment
import com.haoshuang.zhouzhoubang.ui.page.data.rank.RankFragment
import com.mufeng.libs.base.BaseVMActivity
import com.mufeng.libs.utils.view.click
import com.mufeng.libs.utils.startPage

/**
 *  数据统计页面
 */
class DataStatisticsActivity : BaseVMActivity<DataStatisticsViewModel, ActivityDataStatisticsBinding>() {

    companion object {
        fun launch(context: Context){
            context.startPage<DataStatisticsActivity>()
        }
    }

    private val titles = arrayListOf("数据", "分类统计", "排行")
    private val fragments = arrayListOf(DataStatisticsFragment.getInstance(), CategoryStatisticsFragment.getInstance(), RankFragment.getInstance())

    override fun initView(savedInstanceState: Bundle?) {
        binding.titleBar.title = "数据统计"
        binding.titleBar.leftImageView().click { finish() }

        val adapter = ViewPagerAdapter(supportFragmentManager, lifecycle, fragments)
        binding.viewPager.adapter = adapter

        binding.slidingTabLayout.setViewPager2(binding.viewPager, titles)
    }

    override fun initData() {
    }

    override fun startObserve() {
    }

}